package com.explore.demo.controller;


import com.explore.demo.common.ServerResponse;
import com.explore.demo.pojo.CollectRelation;
import com.explore.demo.pojo.RowView;
import com.explore.demo.service.CollectRelationService;
import com.explore.demo.service.RowViewService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author gaolainan
 * @since 2021-04-21
 */
@RestController
@RequestMapping("/row_view")
public class RowViewController {

    @Resource
    private RowViewService rowViewService;

    @GetMapping
    @ApiOperation("查询全部的浏览量，收藏量，评论量的信息")
    public ServerResponse query(){
        return rowViewService.queryAll();
    }

    @PostMapping
    @ApiOperation("通过招聘信息的id  删除对应用户收藏信息")
    public ServerResponse addOne(RowView rowView){
        return rowViewService.addRowView(rowView);
    }

    @DeleteMapping
    @ApiOperation("通过招聘信息的id  删除对应用户收藏信息")
    public ServerResponse deleteByRecruitId(Integer recruitId){
        return rowViewService.deleteByRecruitId(recruitId);
    }

    @PostMapping("/{recruitId}")
    @ApiOperation("根据招聘信息的id 查询对应的浏览量，收藏量，评论量的信息")
    public ServerResponse queryByUserId(@PathVariable("recruitId") Integer recruitId){
        return rowViewService.queryAllByRecruitId(recruitId);
    }
}

